package com.jack.payment.constant.enums;

import com.jack.payment.entity.common.BusinessException;
import com.jack.payment.util.common.StringUtil;

/**
 * 支付平台
 */
public enum PayClientEnum {
    APPLET("Applet"),              // 小程序
    WEB("Web"),                    // Web 页面
    APP("App"),                    // APP
    QRCODE("qrcode")               // 二维码
    ;
    private String values;

    PayClientEnum(String values) {
        this.values = values;
    }

    public String getValues() {
        return values;
    }

    public static PayClientEnum matchingPlatform(String platform) throws BusinessException {
        if (!StringUtil.isEmpty(platform)) {
            for (PayClientEnum payMethod : PayClientEnum.values()) {
                if (payMethod.getValues().equals(platform)) {
                    return payMethod;
                }
            }
        }
        throw new BusinessException();
    }
}
